﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;

namespace AcServerWrapper
{
    public class AcServerLogProcessor
    {
        private RuleConfiguration Rules { get; set; }

        internal int LoadRules(string rulesConfigFilename)
        {
            Rules = RuleConfiguration.Deserialize(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rulesConfigFilename));
            return Rules.Count;
        }

        public void Process(string acLogLine)
        {
            string section = Rules.GetSection(acLogLine);
            log4net.LogManager.GetLogger(section).Debug(acLogLine);
        }
    }
}
